import Router from '@koa/router';
import PlanController from '@/controllers/PlanController';
import { auth, requireSuperAdmin } from '@/middlewares';

const router = new Router({
  prefix: '/api/plans',
});

/**
 * 套餐权限路由 - 挂载在 /api/plans 下
 */

// 获取套餐的权限ID列表
router.get(
  '/:planId/permissions',
  auth,
  requireSuperAdmin,
  PlanController.getPlanPermissions.bind(PlanController),
);

// 为套餐分配权限
router.post(
  '/:planId/permissions',
  auth,
  requireSuperAdmin,
  PlanController.assignPermissions.bind(PlanController),
);

export default router;

